package cn.xuanxuanyuhua.crm.service.impl;


import cn.xuanxuanyuhua.crm.domain.CustomerTransfer;
import cn.xuanxuanyuhua.crm.mapper.CustomerTransferMapper;
import cn.xuanxuanyuhua.crm.query.QueryObject;
import cn.xuanxuanyuhua.crm.service.ICustomerTransferService;
import cn.xuanxuanyuhua.crm.util.UserContext;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CustomerTransferServiceImpl implements ICustomerTransferService {
    @Autowired
    private CustomerTransferMapper cfMapper;


    @Override
    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize(),qo.getOrderBy());
        List<CustomerTransfer> list = cfMapper.queryForList(qo);
        return new PageInfo(list);
    }

    @Override
    public void save(CustomerTransfer entity) {
        entity.setOperateTime(new Date());
        entity.setOperator(UserContext.getActiveUser());
        cfMapper.insert(entity);
    }

}
